<p>Please remember that all actions from this site will be logged.</p>

<?
include("class/calendar.class.php");
?>
<fieldset>
<legend>Outstanding:</legend>
<?php 
$cal=new calendar();
$cal->show();
?>
</fieldset>
<fieldset>
	<legend>Important Discussions:</legend>
	<?php 	
	$result=$db->query("SELECT COUNT(posts.Id) AS PostAnzahl, topics.*,posts.Id AS FoundId FROM topics,posts WHERE topics.Id=posts.Topic AND AllowRead>0 AND AllowRead<=".$_SESSION[user][Rang]." GROUP BY topics.Id ORDER BY topics.Last DESC LIMIT 5");  
	echo "
	<link href=\"templates/default/css/forum.css\" rel=\"stylesheet\" type=\"text/css\" />
	<table class=\"forum\" style=\"width:710px;\">
	  <tr class=\"forum_kat\">
	    <th>&nbsp;</th>
	    <th>Topic</th>
	    <th>Author</th>
	    <th>Replys</th>
	  </tr>";
	  while($topic=$db->fetch_assoc($result))
	  {
	    if($_SESSION[user][Admin]>=$topic[AllowRead])
	    {
	      echo "
	      <tr class=\"beitrag\" onclick=\"location.href='$_SERVER[PHP_SELF]?page=viewtopic&topic=$topic[Id]&post=$topic[FoundId]';\">
	        <td class=\"gelesen\">&nbsp;</td>
	        <td style=\"width:350px;\">$topic[Betreff]</td>
	        <td align=\"center\">$topic[Autor]</td>
	        <td align=\"center\">$topic[Beitraege] (".$topic[PostAnzahl].")</td>
	      </tr>";
	    }
	  }
	?>
	</table>    
</fieldset>           

<fieldset><legend>Teammembers:</legend>
<br>
<table align="center" class="forum" width="600px">
 <tr class="forum_kat">
 
    <th>Username</th>
	<th>Position</th>
	<th>Kontact</th>
	<th>Last Login</th>
  </tr>
 
  <?
  $result=$db->query("SELECT * FROM user WHERE Rang>0 ORDER BY Rang DESC") ;
  while($mitglied=$db->fetch_assoc())
  {
    echo "
    <tr class=\"forum_beitrag\">
      <td>  
	    <a href=\"index.php?page=showuser&id=$mitglied[Id]\">$mitglied[Name]</a>
  	  </td> 
	  <td>
	    ".$config[adminrang][$mitglied[Rang]]."
	  </td>
	  <td>
	    $mitglied[Email]
	  </td>
	  <td>
	    ".date("d.m.Y - H:i:s",$mitglied[Last_Login])."
	  </td>
    </tr>";
  }
?>
</table>
<br>
</fieldset>

<fieldset><legend>Round administrators:</legend>
<br>
<table align="center" class="forum" width="600px">
  <tr class="forum_kat">
    <th>Username</th>
	<th>Round</th>
	<th>Last Action</th>
  </tr>
  <?
  $result=$db->query("SELECT * FROM spieler WHERE Admin>0 ORDER BY Server ASC") ;
  while($mitglied=$db->fetch_assoc($result))
  {
    $db->query("SELECT * FROM server WHERE Id=$mitglied[Server];");
    $srv=$db->fetch_assoc();
    echo "
    <tr>
	  <td><a href=\"index.php?page=showuser&id=$mitglied[User]\">$mitglied[Name]</a></td>
	  <td>$srv[Speed]x - $srv[Name]</td>
	  <td>".date("d.m.Y H:i:s", $mitglied[Last])."</td>
	</tr>";
  }
  ?>
</table>
</fieldset>

<fieldset><legend>Administration History</legend>
<textarea rows="10" cols="88" readonly="readonly" id="loglist"><?
  if(!file_exists("logs/admin.txt")){
      echo "we are lazy----nothing found";
  }else{
      $logfile=file_get_contents("logs/admin.txt");
      $logfile=explode("\n",$logfile);
      $anzahl=count($logfile);
      $start=$anzahl-50;
      if($start<0) $start=0;
      for($i=$start; $i<$anzahl; $i++){
          echo $logfile[$i]."\n";
	  }
  }
  ?>
</textarea>
<script type="text/javascript">
  document.getElementById('loglist').scrollTo(0,600); 
</script>
</fieldset>

<fieldset><legend>Changelog</legend>
<textarea rows="10" cols="88" readonly="readonly"><?
  if(!file_exists("logs/updates.txt")){
      echo "no changelog written";
  }else{
      $logfile=file_get_contents("logs/updates.txt");
      $logfile=explode("\n",$logfile);
      $anzahl=count($logfile);
      $start=$anzahl-50;
      if($start<0) $start=0;
      for($i=$start; $i<$anzahl; $i++){
          echo $logfile[$i]."\n";
	  }
  }
?>
</textarea>
</fieldset>


<fieldset><legend>included classes</legend>
<table class="forum" width="600px">
  <tr>
    <th>Software</th>
	<th>Version</th>
	<th>Author</th>
  </tr>
  <?
  $dir=opendir("class");
  while($file=readdir($dir)) 
  {
      if(!is_dir($file))
	  {
	      $erg=file_get_contents("class/$file");
		  if(preg_match("!##SWSDATA:<>(.*)<>(.*)<>(.*)##!i",$erg,$finds))
		  {
              echo "
	          <tr>
	            <td>".$finds[1]."</td>
	            <td>".$finds[3]."</td>				
	            <td>".$finds[2]."</td>				
			  </tr>";
		  }
	  }
  }
  ?>
</table>
</fieldset>